Skip to content

Conversation

@estebank
Copy link
Contributor

@estebank estebank commented Nov 3, 2025

More accurate span pointing at use place of outer param (at ident instead of full path).

Add note explaining why outer item params can't be used in inner item.

Use structured suggestion for what Self should have been.

Follow up to #148370.

Fix #37892.

```
error[E0401]: can't use `Self` from outer item
  --> $DIR/E0401.rs:22:25
   |
LL | impl<T> Iterator for A<T> {
   | ---- `Self` type implicitly declared here, by this `impl`
...
LL |         fn helper(sel: &Self) -> u8 {
   |            ------       ^^^^ use of `Self` from outer item
   |            |
   |            `Self` used in this inner function
   |
help: refer to the type directly here instead
   |
LL -         fn helper(sel: &Self) -> u8 {
LL +         fn helper(sel: &A<T>) -> u8 {
   |
```
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 3, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 3, 2025

r? @jackh726

rustbot has assigned @jackh726.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@jackh726
Copy link
Member

jackh726 commented Nov 3, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 3, 2025

📌 Commit 14646ec has been approved by jackh726

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 3, 2025
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Nov 3, 2025
Tweak E0401

More accurate span pointing at use place of outer param (at ident instead of full path).

Add note explaining why outer item params can't be used in inner item.

Use structured suggestion for what `Self` should have been.

Follow up to rust-lang#148370.

Fix rust-lang#37892.
bors added a commit that referenced this pull request Nov 3, 2025
Rollup of 7 pull requests

Successful merges:

 - #147141 (Suggest making binding `mut` on `&mut` reborrow)
 - #147945 (Port `cfg!()` macro to the new attribute parsing system )
 - #147951 (Add check for `+=` typo in let chains)
 - #148004 (fix: Only special case single line item attribute suggestions)
 - #148264 (reflect that type and const parameter can be intermixed)
 - #148363 (Fix `wasm_import_module` attribute cross-crate)
 - #148447 (Tweak E0401)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit bcf227a into rust-lang:master Nov 4, 2025
11 checks passed
rust-timer added a commit that referenced this pull request Nov 4, 2025
Rollup merge of #148447 - estebank:outer-param-2, r=jackh726

Tweak E0401

More accurate span pointing at use place of outer param (at ident instead of full path).

Add note explaining why outer item params can't be used in inner item.

Use structured suggestion for what `Self` should have been.

Follow up to #148370.

Fix #37892.
@rustbot rustbot added this to the 1.93.0 milestone Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using type with local type parameters has confusing error

4 participants